global keepers1985 ""


numlabel, add

drop if v5==2

drop if v2~=10

genl yr=1985
global keepers1985 $keepers1985 yr

genl id=v1
global keepers1985 $keepers1985 id

merge 1:1 v1 using "$sourcedatadir/se/vu85ink.dta" /* Note: duplicate observations deleted from the file first using */
/* duplicates drop */
drop if _merge==2

genl income=V910
genl income3=income
centile income, c(33 66 100)
replace income3=0 if income<=r(c_1)
centile income, c(33 66 100)
replace income3=1 if income>r(c_1) & income<=r(c_2)
centile income, c(33 66 100)
replace income3=2 if income>r(c_2) & income<=r(c_3)
global keepers1985 $keepers1985 income3

genl pid_ce=(v190==22 & v191==1)
replace pid_ce=. if v189==.
global keepers1985 $keepers1985 pid_ce

gen pid_gov=pid_ce
global keepers1985 $keepers1985 pid_gov

genl vote_ce=v206
recode vote_ce 22=1 .=. else=0
global keepers1985 $keepers1985 vote_ce

genl vote_gov=vote_ce
global keepers1985 $keepers1985 vote_gov


genl gpi=v36
replace gpi=abs(gpi-4)/3
global keepers1985 $keepers1985 gpi

genl socref=v166
recode socref 8=2.5 6/9=.
replace socref=abs(socref-4)/3
global keepers1985 $keepers1985 socref

genl degree=v319
recode degree 7=1 0/6 8=0 9=.
global keepers1985 $keepers1985 degree


// Class/occupation

gen class_resp_3cat = v312
recode class_resp_3cat 1/7=3 10/25=2 30/40=1 0=.
replace class_resp_3cat = . if class_resp_3cat > 40
label variable class_resp_3cat "Social class (3 cats.): higher value is higher class"
*label define LblClassGrade 1 "A: (Higher man.; prof." 2 "B: Lower man.; admin." 3 "C1A: Skilled; supervis. non-manu." 4 "C1B: Lower non-manu." 5 "C2: Skilled manu." 6 "D: Unskilled manu."
*label values class_head_grade LblClassGrade
global keepers1985 $keepers1985 class_resp_3cat

gen class_spou_3cat = v332
recode class_spou_3cat 1/7=3 10/25=2 30/40=1 0=.
replace class_spou_3cat = . if class_spou_3cat > 40
label variable class_spou_3cat "Social class (3 cats.): higher value is higher class"
*label define LblClassGrade 1 "A: (Higher man.; prof." 2 "B: Lower man.; admin." 3 "C1A: Skilled; supervis. non-manu." 4 "C1B: Lower non-manu." 5 "C2: Skilled manu." 6 "D: Unskilled manu."
*label values class_head_grade LblClassGrade
global keepers1985 $keepers1985 class_spou_3cat

gen class_reho_3cat_strata = v392
recode class_reho_3cat_strata 1=1 2=1 3=2 4=2 5=1 6=2 7=2 8=. 10=. 88=. 96=. 99=.
replace class_reho_3cat_strata = . if class_reho_3cat_strata > 40
label variable class_reho_3cat_strata "Social class (3 cats.): higher value is higher class"
*label define LblClassGrade 1 "A: (Higher man.; prof." 2 "B: Lower man.; admin." 3 "C1A: Skilled; supervis. non-manu." 4 "C1B: Lower non-manu." 5 "C2: Skilled manu." 6 "D: Unskilled manu."
*label values class_head_grade LblClassGrade
global keepers1985 $keepers1985 class_reho_3cat_strata

gen male = v365
recode male 1=1 2=0
global keepers1985 $keepers1985 male

gen married = v328
recode married 1=1 2/3=0 6=. 9=.
global keepers1985 $keepers1985 married

gen unionmem_resp = v322
recode unionmem_resp 1/4=1 5=0 8=.
global keepers1985 $keepers1985 unionmem_resp

*gen unionmem_spou = v259
*recode unionmem_spou 1/4=1 .=0
*global keepers1979 $keepers1979 unionmem_spou



// Pascal/SM moderators


 foreach var of varlist      v235 v236 v237 v238 v239 v240 v241 v242{
        gen Z`var'=`var'/10
		replace Z`var'=0.5 if `var'==88
		replace Z`var'=. if `var'>=90
				tab Z`var' `var', m
  }


rename Zv235 influence_bluecollar
lab var  influence_bluecollar "1=blue collar unions have to much influence" 

rename Zv236 influence_SAF_employers
lab var  influence_SAF_employers "1=SAF employers organisation have to much influence" 

rename Zv237 influence_private
lab var  influence_private "1= private business and industries have to much influence" 

rename Zv238 influence_press
lab var  influence_press "1=press radio and TV  have to much influence" 

rename Zv239 influence_electorate
lab var  influence_electorate "1=electorate have to much influence" 


rename Zv240 influence_parliament 
lab var  influence_parliament "1=parliament have to much influence" 

rename Zv241 influence_government
lab var  influence_government "1=government  has to much influence" 

rename Zv242 influence_civil
lab var  influence_civil "1=civil servants  has to much influence" 




 gen party_ID=. 
   replace party_ID=1 if v189==1 & v190==11
   replace party_ID=2 if v189==1 & v190==22
   replace party_ID=3 if v189==1 & v190==33
   replace party_ID=4 if v189==1 & v190==44
  
   replace party_ID=6 if v189==1 & v190==66
   replace party_ID=7 if v189==1 & v190==87

   replace party_ID=8 if v189==1 & v190==88
   
   replace party_ID=9 if v189==1 & v190==12
 
   replace party_ID=10 if v189==1 & v190==55
 
 replace party_ID=11 if v189==1 & v190==13
 replace party_ID=12 if v189==1 & v190==71
 replace party_ID=13 if v189==1 & v190==72
 replace party_ID=14 if v189==1 & v190==73
replace party_ID=15 if v189==1 & v190==82
replace party_ID=16 if v189==1 & v190==14
replace party_ID=17 if v189==1 & v190==15
replace party_ID=18 if v189==1 & v190==9

 lab def party_ID 1 "v‰nsterpartiet kom " 2 "socialdemokraterna" 3"centerpartiet" 4"folkpartiet" 5"hˆgerpartiet" 6"kristen demokratis" 7 "other" 8 "will not answer"9 " kommunistiska fˆrbundet marxist-len" 10 " moderata samlingspartiet " 11 "sveriges kommunis" 12 "borgerligt "  13 "FC+C" 14 "lokal borgerlig" 15 "skÂnepartiet" 16 "kommunistiska arbetarefˆrbundet" 17 "vpk, apk, kpmlr, skp, kaf" 18 "grˆnt parti" 19 "ny demokrati"
 lab val party_ID party_ID
  tab party_ID, m
 tab party_ID v190, m


 foreach var of varlist  v99 v100 v101 v103 v105 v104 v106 v108{
        gen Z`var'=`var'
		replace Z`var'=5 if `var'==1
		replace Z`var'=4 if `var'==2
		replace Z`var'=3 if `var'==8 | `var'==3
		replace Z`var'=2 if `var'==4
		replace Z`var'=1 if `var'==5
		replace Z`var'=(Z`var'-1)/4
		tab Z`var' `var', m
  }

rename Zv99 cut_public
lab var cut_public "1=good idea to reduce size of public sector"

rename Zv100 abolish_transfer
lab var abolish_transfer"1=good idea abolish the wage earners' funds"

rename Zv101 socialize
lab var socialize "1=good idea to socialize large industries" 

rename Zv103 reduce_control
lab var reduce_control "1=good idea to reduce gov influence on enterprises" 

rename Zv104 cut_benefit
lab var cut_benefit "1=good idea to reduce social benefits"


rename Zv105 immigrants_culture
lab var immigrants_culture"1=good idea to reduce social benefits"

rename Zv106 private_health
lab var private_health "1=good idea to increase private run health care"

rename Zv108 red_tax_high
lab var red_tax_high "1=good idea to cut taxes on high incomes" 


gen transfer2=.
replace transfer2=1 if v123==1
replace transfer2=0.5 if v123==3 | v123==8
replace transfer2=0 if v123==5
replace transfer2=. if v123==6 | v123==9
lab var transfer2 "1=favor transfer business profit to union funds"
tab transfer2 v123, m

gen parent_allowance=.
replace parent_allowance=1 if v158==1
replace parent_allowance=0.5 if v158==3 | v158==8
replace parent_allowance=0 if v158==5
replace parent_allowance=. if v158==6 | v158==9
lab var parent_allowance "1=favor parent allowance"
tab parent_allowance v158, m

gen right=v201/10
replace right=0.50 if right>1 & right~=.
  tab right v201, m
  lab var right "1=far right"



     gen talk_politic=.
 replace talk_politic=1 if v37==1
 replace talk_politic=0.66 if v37==2
replace talk_politic=0.33 if v37==3
replace talk_politic=0 if v37==4
replace talk_politic=0.5 if v37==8
 replace talk_politic=. if v37==6 | v37==9
 
 tab v37 talk_politic, m
  lab var talk_politic "1=often talk politic outside and inside family" 



gen newspaper_politics=.
 replace newspaper_politics=0 if v28==1
 replace newspaper_politics=0.33 if v28==2
 replace newspaper_politics=0.66 if v28==3
 replace newspaper_politics=1 if v28==4
  replace newspaper_politics=0.5 if v28==8
tab newspaper_politics v28,m
 lab var newspaper_politics "1=read more politic articles"

 foreach var of varlist  v178 v180{
        gen Z`var'=`var'/10
		replace Z`var'=0.5 if Z`var'>1
		replace Z`var'=. if `var'==.
			tab Z`var' `var', m
  }

rename Zv178 m_market_oriented
lab var m_market_oriented "1=favor move toward more free-market"

rename Zv180 m_socialism
lab var m_socialism "1=favor move toward socialism"

gen cut_public2=.
replace cut_public2=1 if v135==1
replace cut_public2=0.5 if v135==3 | v135==8
replace cut_public2=0 if v135==5
lab var cut_public2 "1=favor reduction of public sector size"
tab cut_public2 v135, m


    foreach var of varlist v165{
        gen Z`var'=`var'
		replace Z`var'=1 if `var'==4
		replace Z`var'=2 if `var'==3
		replace Z`var'=2.5 if `var'==8
		replace Z`var'=3 if `var'==2
		replace Z`var'=4 if `var'==1
            replace Z`var'=. if `var'==6 | `var'==9 
		replace Z`var'=(Z`var'-1)/3
		tab Z`var' `var', m
  }



    rename Zv165 econ_control
  lab var  econ_control "1=agree state control limit bank and industry influence"


foreach var of varlist  influence_SAF_employers influence_private influence_parliament{
        
gen anti_`var'=.
replace anti_`var'=0 if `var'==1
replace anti_`var'=0.1 if `var'>=0.88 & `var'<=0.91 
replace anti_`var'=0.2 if `var'>=0.78 & `var'<=0.81 
replace anti_`var'=0.3 if `var'>=0.68 & `var'<=0.71 
replace anti_`var'=0.4 if `var'>=0.58 & `var'<=0.61 
replace anti_`var'=0.5 if `var'>=0.48 & `var'<=0.51 
replace anti_`var'=0.6 if `var'>=0.38 & `var'<=0.41 
replace anti_`var'=0.7 if `var'>=0.28 & `var'<=0.31 
replace anti_`var'=0.8 if `var'>=0.18 & `var'<=0.21 
replace anti_`var'=0.9 if `var'>=0.08 & `var'<=0.11 
replace anti_`var'=1 if `var'==0
  }
tab anti_influence_SAF_employers influence_SAF_employers,m 
tab anti_influence_private influence_private, m
tab anti_influence_parliament influence_parliament, m


gen anti_socialize=.
replace anti_socialize=0 if socialize==1
replace anti_socialize=0.25 if socialize==0.75
replace anti_socialize=0.5 if socialize==0.5
replace anti_socialize=0.75 if socialize==0.25
replace anti_socialize=1 if socialize==0
tab anti_socialize socialize, m

gen anti_transfer2=.
replace anti_transfer2=0 if transfer2==1
replace anti_transfer2=0.5 if transfer2==0.5
replace anti_transfer2=1 if transfer2==0
tab anti_transfer2 transfer2, m

gen anti_m_socialism=.
replace anti_m_socialism=0 if m_socialism==1
replace anti_m_socialism=0.1 if m_socialism>=0.88 & m_socialism<=0.91 
replace anti_m_socialism=0.2 if m_socialism>=0.78 & m_socialism<=0.81 
replace anti_m_socialism=0.3 if m_socialism>=0.68 & m_socialism<=0.71 
replace anti_m_socialism=0.4 if m_socialism>=0.58 & m_socialism<=0.61 
replace anti_m_socialism=0.5 if m_socialism>=0.48 & m_socialism<=0.51 
replace anti_m_socialism=0.6 if m_socialism>=0.38 & m_socialism<=0.41 
replace anti_m_socialism=0.7 if m_socialism>=0.28 & m_socialism<=0.31 
replace anti_m_socialism=0.8 if m_socialism>=0.18 & m_socialism<=0.21 
replace anti_m_socialism=0.9 if m_socialism>=0.08 & m_socialism<=0.11 
replace anti_m_socialism=1 if m_socialism==0
tab anti_m_socialism m_socialism, m

gen anti_econ_control=.
replace anti_econ_control=0.3333333 if econ_control>0.5 & econ_control<1
replace anti_econ_control=0.6666666 if econ_control>0 & econ_control<0.5
replace anti_econ_control=1 if econ_control==0
replace anti_econ_control=0.5 if econ_control==0.5
replace anti_econ_control=0 if econ_control==1
tab anti_econ_control econ_control, m

gen index_interest=(gpi+talk_politic+newspaper_politics)/3
global keepers1985 $keepers1985 index_interest

gen index_market_oriented=( socref+ influence_bluecollar+ anti_influence_SAF_employers +anti_influence_private+ anti_influence_parliament +influence_government+  cut_public+ abolish_transfer+ anti_socialize+ reduce_control+  private_health+ anti_transfer2+ right+ m_market_oriented +anti_m_socialism+ cut_public2+ anti_econ_control+ cut_benefit)/18
global keepers1985 $keepers1985 index_market_oriented
